<?php

class HomeController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| Default Home Controller
	|--------------------------------------------------------------------------
	|
	| You may wish to use controllers instead of, or in addition to, Closure
	| based routes. That's great! Here is an example controller method to
	| get you started. To route to this controller, just add the route:
	|
	|	Route::get('/', 'HomeController@showWelcome');
	|
	*/

	public function showWelcome()
	{
		return View::make('hello');
	}
	
	public function showLogin() {
		return View::make('login');
	}
	
	public function doLogin() {
		
		// create our user data for the authentication
		$userdata = array(
				'email' 	=> Input::get('email'),
				'password' 	=> Input::get('password')
		);
		
		// attempt to do the login
		if (Auth::attempt($userdata)) {
			return Redirect::to('/');
		
		} else {
		
		// validation not successful, send back to form
			return Redirect::to('login');
		
		}
	}

}
